<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>跟随鼠标的天使</title>

    <style>
        .angel {
            position: absolute;
            transform: translate(-50%, -50%);
        }
    </style>
</head>

<body>
    <img src="./images/angel.gif" alt="" class="angel">
    <script>
        let angel = document.querySelector('.angel');

        document.addEventListener('mousemove', function (e) {
            angel.style.left = e.pageX + 'px';
            angel.style.top = e.pageY + 'px';
        })
    </script>
</body>

</html>